package FILE;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @Description:读取文件内容简单演示
 * @Author:AMark
 * @Date: 10/25/2023
 */
public class FileRead {
    public static void main(String[] args) {
        try {
            File file = new File("E:\\Obsidian\\CS\\CS Code\\Java\\learning-java\\IOStream\\test.txt");
            FileInputStream fis = new FileInputStream(file);
            int n;
            while ((n = fis.read()) != -1) {
                System.out.print((char) n);
            }
            fis.close();
        }
        catch (FileNotFoundException fileNotFoundException) {
            System.out.print("未能成功而打开文件");
        } catch (IOException ioException) {
            System.out.print("文件输入异常");
        }
    }
}